package com.desksoft.ecommerce.vo.mall;

import com.desksoft.ecommerce.helper.mall.SearchItemDataHelper;
import com.desksoft.utility.list.BaseSort;

/***************************************
 * <pre>
 * 版权所有：杭州迪科软件 保留所有权利
 * 创建日期: 2012-5-29
 * 创建作者：rq
 * 文件名称：SearchItemVO.java
 * 版本：1.0
 * 功能：
 * 最后修改时间：2012-5-29
 * 修改记录：
 * </pre>
 *****************************************/
public class SearchItemVO extends BaseSort {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static final String OPAT_ADD = "add";
	public static final String OPAT_UPD = "update";
	public static final String OPAT_DEL = "del";

	private String type;
	private String name;
	// 类别code的格式(CategoryCode-clazz-fatherCategoryCode),其他类型的code的格式(code-CategoryCode)
	private String code;
	private String opat;

	private String typename;// 类型名称

	private String typenames;//B2B类型名称
	private String value;//

	public String getTypenames() {
		return typenames;
	}

	public void setTypenames(String typenames) {
		this.typenames = typenames;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getTypename() {
		if (type.equals(SearchItemDataHelper.CATE_TYPE))
			return SearchItemDataHelper.CATE_NAME;
		if (type.equals(SearchItemDataHelper.BRAND_TYPE))
			return SearchItemDataHelper.BRAND_NAME;
		if (type.equals(SearchItemDataHelper.PRICE_TYPE))
			return SearchItemDataHelper.PRICE_NAME;
		if (type.equals(SearchItemDataHelper.DESC_TYPE))
			return SearchItemDataHelper.DESC_NAME;
		return typename;
	}

	public void setTypename(String typename) {
		this.typename = typename;
	}

	private String categoryCode;// 关联的类别码

	public String getCategoryCode() {
		return categoryCode;
	}

	public void setCategoryCode(String categoryCode) {
		this.categoryCode = categoryCode;
	}

	public String getOpat() {
		return opat;
	}

	public void setOpat(String opat) {
		this.opat = opat;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object obj) {
		if (obj instanceof SearchItemVO) {
			String type = ((SearchItemVO) obj).getType();
			String code = ((SearchItemVO) obj).getCode();
			if (type.equals(this.type) && code.equals(this.code)) {
				return true;
			}
		}
		return false;
	}

}
